#!/bin/bash

export LANG="GB2312";


# 删除源包
read -p "环境: "  mode;

read -p "打包类型: " fileType;

rm -rf dist dist.zip dist.tar.gz

echo -e "\r\n";

# echo $mode;
echo "执行[$mode]环境的打包";

echo "打包为[$fileType]的包";
echo -e "\r\n";

npm run $mode

if [ $fileType == "zip" ]
then
  zip -r -o dist.zip ./dist
  echo -e "\r\n";
  echo "zip building end";
else
  tar -zcvf dist.tar.gz ./dist
  echo -e "\r\n";
  echo "tar building end";
fi;

echo -e "\r\n";

